<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>批量发货 -- 大眼窝进销存系统</title>
<load href='__PUBLIC__/bootstrap/css/bootstrap.min.css' />
<load href='__PUBLIC__/Css/style.css' />
<style type="text/css">
	.order_info{height:352px;margin-left: 5px;}
	.order_info .row {min-height: 19px;line-height: 19px;}
        .wrap-word{word-wrap:break-word;}
        [class*="span"] {
              float: left;
	      margin-left: 5px;
        }
        .alert{padding:8px 0 0 0;}
        </style>


<?php 
	function merge_order_detail(&$order_detail,$sale_detail){
        foreach ($sale_detail as $key => $value) {
            __merge_order_detail($order_detail,$sale_detail,$value,$key);
        }
        return $order_detail;
    }

    function __merge_order_detail(&$order_detail,$sale_detail,$value,$key){
       
            if($key == 0)
                $order_detail[0] = $value;
            else{
                if( !empty($value['out_number'])  
                	&& $value['out_number'] == $sale_detail[$key-1]['out_number']
                   && $value['options'] == $sale_detail[$key-1]['options'] ){
                    if(is_array($order_detail[$key-1])){
                       $order_detail[$key-1]['number'] += $value['number'];
                        $order_detail[$key-1]['total'] += $value['total']; 
                    }else{
                        __merge_order_detail($order_detail,$sale_detail,$value,$key-1);
                    }
                    
                }else
                   $order_detail[$key] = $value;
            }
        return $order_detail;
    }

    function get_clear_url($url = "")
    {
      if(empty($url))
          return;
      $length = strpos($url,'/tab/');
     if($length !== false)
        return substr($url,0,$length);
     else
        return $url; 
    }
 ?>
</head>
<body onLoad="document.shipping<empty name='_REQUEST.tab'>1<else/>{$_REQUEST.tab}</empty>.logino.focus()">
<div id="main" class="main" >
<div class="row  heading" style="margin-left:10px;">
				<div class="span1" >序号</div>
				<div class="span3" >订单号</div>
				<div class="span1">收货人</div>
				<div class="span5">地址</div>
				<div class="span2">快递</div>
				<div class="span2">单号</div>
				<div class="span1">发货</div>
			</div>
	<volist name="orders" id="vo">
			
			<div class="row <if condition="$key%2 == 0"> alert</if>" style="margin-left:10px;">
				<form action="__URL__/update" method="post" name="shipping{$i}"	>
				<div class="span1">{$key+1}</div>
				<div class="span3 wrap-word" >
                    <input type="hidden" name="id" value="{$vo.id}">
					<input type="hidden" name="shipping_time" value="{:time()}"> 
					<input type="hidden" name="order_status" value="3"> <!--已发货-->
					<input type="hidden" name="jumpUrl" value="{:get_clear_url(__SELF__)}/tab/{$i}"> <!--返回发货路径-->
                    <eq name="vo.prepare_status" value="2"> <span class="label label-important">缺货</span></eq>
              <php>$is_virtual = is_all_virtual($vo['id']); </php>     
                    <eq name="is_virtual" value="1"> <span class="label label-important">虚拟物品</span></eq> 
                    {$vo.sale_no} &nbsp;&nbsp; ({$vo.mall_no})
		</div>
				<div class="span1 wrap-word">{$vo.shipping_name}</div>
				<div class="span5">{$vo.address} ({$vo.mobile})</div>
				<div class="span2"> <input type="text" class="span2" name="logino" value="{$vo.logino}"> </div>
				<!--默认天天快递 2013-0701改为中通 20130919改为圆通 20131108汇通快运 131209韵达-->
				<div class="span2"	>
                    <empty name="vo.logicompany_id">
                        {:modList('Logicompany',21,'span2','logicompany_id','sort desc' )}
                    <else/>
                        {:modList('Logicompany',$vo['logicompany_id'],'span2','logicompany_id','sort desc' )}
                    </empty>
				</div>
				<div class="span1"><input type="submit" class="btn btn-primary" value="发货"></div>
				</form>
			</div>
	</volist>
	

</div>
</body>
</html>
